#include<bits/stdc++.h>
#define gc getchar
#define itn int
#define x first
#define y second
#define eb emplace_back
#define em emplace
#define pb push_back
#define db double
#define y1 yy1_yyds
using namespace std; typedef long long ll; typedef unsigned long long ull;
// https://www.luogu.com.cn/discuss/522581 About "const"
ll read() {
	ll x = 0; short fh = 1; char ch = gc();
	while (!isdigit(ch)) {
		if (ch == '-') fh = -1;
		if (ch < 10) exit(0); 
		ch = gc();
	}
	while (isdigit(ch))
		x = x * 10 + (ch ^ 48), ch = gc();
	return fh * x;
}
#ifndef ONLINE_JUDGE
void debug() {cerr << "\n";}
template<typename Typ1> void debug(Typ1 arg) {cerr << arg << "\n";}
template<typename Typ1, typename ...Typ2> void debug(Typ1 arg, Typ2 ...args) {
	cerr << arg << " ", debug(args...);
}
#else
void debug() {}
template<typename Typ1> void debug(Typ1 arg) {}
template<typename Typ1, typename ...Typ2> void debug(Typ1 arg, Typ2 ...args) {}
#endif
void writeln(ll arg) {printf("%lld\n", arg);}
template<typename ...Typ2> void writeln(ll arg, Typ2 ...args) {
	printf("%lld ", arg), writeln(args...);
}
typedef pair <int, int> pii; typedef pair <ll, ll> pll;
const char Y_E_S[] = "YES", N__O[] = "NO";
// const char Y_E_S[] = "Yes", N__O[] = "No";
// #define infinite_testcase
// #define multiple_testcase
// #define output_Yes_No
const int DUST = 327, N = 214514, M = -1;
int n, L, a[N], b[N];
namespace Sub1 {
	void major() {
		int ans = 0;
		for(int st = 0; st < 1 << n; st++) {
			int ax = 0, bx = 0;
			for(int i = 0; i < n; i++) if(st >> i & 1)
				ax ^= a[i + 1], bx ^= b[i + 1];
			if(ax <= L) ans = max(ans, bx);
		}
		writeln(ans);
	}
}
namespace Sub3 {
	// struct Trie {
		// int ch[2]; int ans = 0;
		// Trie() {ch[0] = ch[1] = /*0*/-1;}
	// }T[N * 11]; int idx1 = 0;
	// void insert(int x) {
		// int u = 0;
		// for(int j = 9; ~j; j--)
			// if(~T[u].ch[x >> j & 1])
				// u = T[u].ch[x >> j & 1];
			// else u = T[u].ch[x >> j & 1] = ++idx1;
		// T[u].ans = x;
	// }
	// int qxormax(int x) {
		// int u = 0;
		// // if(T[u].ch[0] == -1 && T[u].ch[1] == -1) return x;
		// for(int j = 9; ~j; j--)
			// if(~T[u].ch[(x >> j & 1) ^ 1])
				// u = T[u].ch[(x >> j & 1) ^ 1];
			// else u = T[u].ch[x >> j & 1];
		// // debug(x, u, T[u].ans);
		// return x ^ T[u].ans;
	// }
	int p2[10];//第二个线性基/jk
	void insert(int x) {
		for(int j = 9; ~j; j--) if(x >> j & 1) {
			if(p2[j]) x ^= p2[j];
			else {
				p2[j] = x;
				break;
			}
		}
	}
	int qxormax(int x) {
		for(int j = 9; ~j; j--) if(!(x >> j & 1)) {
			if(!p2[j]) continue;
			x ^= p2[j];
		}
		return x;
	}
	int p[10], c[10];//p：某一位上的线性基，c：这个线性基的b
	void major() {
		// insert(0);
		for(int i = 1; i <= n; i++) {
			int x = a[i], y = b[i];
			for(int j = 9; ~j; j--) if(x >> j & 1) {
				if(p[j]) x ^= p[j], y ^= c[j];
				else {
					p[j] = x, c[j] = y; break;
				}
			}
			if(!x)
				// debug(y),
				insert(y);
		}
		// for(int i = 0; i < 10; i++) debug(i, p[i], c[i]);
		int ans = 0;
		for(int st = 0; st < 1 << 10; st++) {
			int ax = 0, bx = 0;
			for(int i = 0; i < 10; i++) if(st >> i & 1)
				ax ^= p[i], bx ^= c[i];
			if(ax <= L) ans = max(ans, qxormax(bx));
		}
		writeln(ans);
	}
}
bool major(int Case = 1) {
	n = read(), L = read();
	for(int i = 1; i <= n; i++) a[i] = read(), b[i] = read();
	if(n <= 18) return Sub1::major(), 0;
	return Sub3::major(), 0;
	return Case ^= Case ^ Case;
}
void initial_function(int argc, char **argv) {
	**argv = argc; /* <- place_holder
	you won't give up no matter what happens, will you?
	code time: 00:
	---
	
	（拍出来的）a=0的时候可能有多个b一起异或，所以得写第二个线性基（）。trie 树只能求一个 xor 的最大值
	10:40 又拍上了
	*/
	freopen("lock.in", "r", stdin);
	freopen("lock.out", "w", stdout);
}
signed main(int argc, char **argv) {
	initial_function(argc, argv);
	int Case = 1, Maxcase = 1;
	for (
#ifdef multiple_testcase
		  Maxcase = read()
#endif
				     	  ;
#ifndef infinite_testcase
							Case <= Maxcase
#endif
				     					   ; Case++)
#ifdef output_Yes_No
		puts(major(Case) ? Y_E_S : N__O);
#else
		major(Case);
#endif
	return DUST ^ 0x147;
}
